// 封装频道接口

import axios from '@/utils/request'

/**
 * 获取默认频道
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getUserChannels = () => {
  return axios.get('/v1_0/user/channels')
}

/**
 * 获取所有频道
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getChannels = () => axios.get('/v1_0/channels')

/**
 * 添加用户频道
 * @param channels 频道列表
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const setUserChannels = (channels) =>
  axios.patch('/v1_0/user/channels', {
    channels
  })

/**
 * 删除用户频道
 * @param target
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteUserChannel = (target) =>
  axios.delete('/v1_0/user/channels/' + target)
